package com.pig4cloud.pig.admin.controller;


import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.demo.api.feign.RemoteDemoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.pig4cloud.pig.common.core.constant.SecurityConstants.FROM_IN;

@RestController
@RequiredArgsConstructor
@RequestMapping("/test")
@Api(value = "TestFeign", tags = "TestFeign模块")
public class TestFeignController {


	private final RemoteDemoService remoteDemoService;

	/**
	 * testFeign
	 * @return
	 */
	@ApiOperation(value = "调用demo模块的feign", notes = "调用demo模块的feign")
	@GetMapping("/testFeign" )
//	@PreAuthorize("@pms.hasPermission('demo_sysuser_get')" )
	public R testFeign() {
		com.pig4cloud.pig.demo.api.feign.SysLog sysLog = new com.pig4cloud.pig.demo.api.feign.SysLog();
		sysLog.setId(1l);
		System.out.println("=====================开始调用==========================");
		return R.ok(remoteDemoService.saveLog(sysLog, FROM_IN));
	}

}
